///首页对象，待扩展
var shopStore = {
};

$(function(){
    shopStore.init();
});
shopStore.init=function(){
    //页面加载事件需添加内容
    this.methods.bannerInit(this);
    //tab标签页
    this.methods.tabInit(this);
    //热销榜
    this.methods.hotInit(this);
    //滚动初始化
    this.methods.SliderInit(this);
};
shopStore.addEvent=function(){
    //事件管理
};
shopStore.methods = {};
shopStore.data={};
//轮播组件
shopStore.methods.bannerInit=function(obj){
    var banner = new Swiper(".shop-banner",{
        direction: 'horizontal',
        speed: 300,     //切换速度
        loop:true,      //循环播放
        autoplay:true,
        delay:3000,     //轮播周期
        //分页容器
        pagination:{
            el: '.swiper-pagination',
            clickable:true
        },
        navigation:{
            nextEl:'.swiper-button-next',
            prevEl:'.swiper-button-prev'
        }
        //需要滚动条
        // ,
        // scrollbar:{
        //     el:'.banner-scrollbar'
        // }
    });
}
//tab组件初始化方法
shopStore.methods.tabInit = function(obj){
    $(".shop-floor").each(function(val){
        if($(this).find(".shop-floor-nav")){
            //有tab，添加tab控件
            var tab = new Controller.TabControl({
                container:$(this),
                tabNavItem:".shop-floor-nav-item",
                tabConItem:".shop-floor-container",
                tagName:"data-id",
                event:"mouseover"
            });
        }
    });
    var hottab = new Controller.TabControl({
        container:$(".shop-hot-sell"),
        tabNavItem:".shop-floor-nav-item",
        tabConItem:".shop-rank-container-right",
        tagName:"data-id",
        event:"mouseover"
    });
}
shopStore.methods.hotInit =function(obj){
    $(".shop-rank-container .shop-rank-container-right li").off("mouseover").on("mouseover",function(){
        $(this).siblings("li").removeClass("bigli").removeClass("normalli").addClass("normalli");
        $(this).removeClass("normalli");
        $(this).addClass("bigli");
    });
}
shopStore.methods.SliderInit=function(obj){
    var slider = new Controller.Slider({
        father: ".shop-flash-right",
        container:"ul",
        prevBtn: ".shop-flash-left-nav",
        nextBtn: ".shop-flash-right-nav",
        itemSelector: "li",
        fatherSize: 1440
    });
}